feat: add upload cache preflight#379
Conversation
e5ce14d to
ae54ba6
Compare
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5ce14dffe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!response.ok) { | ||
| throw new AppError('COMMAND_FAILED', `Upload preflight failed: ${body}`, { | ||
| statusCode: response.status, | ||
| hint: 'Verify the remote daemon artifact upload cache endpoint is available and authorized.', | ||
| }); |
There was a problem hiding this comment.
Fallback to upload when preflight returns non-2xx
This makes upload preflight a hard dependency: any non-2xx response now throws and aborts before the regular /upload path is attempted. In real deployments where preflight is partially rolled out or temporarily unhealthy (for example 5xx/403 from an upstream cache/auth layer), artifact uploads that previously worked will now fail even though the upload endpoint is still available. Since preflight is an optimization, this path should degrade to a cache miss and continue with normal upload instead of failing the command.
Useful? React with 👍 / 👎.
ae54ba6 to
9c58da6
Compare
9c58da6 to
61bb45c
Compare
Summary
Adds automatic SHA-256 upload preflight for file artifacts sent to remote/cloud daemons, returning cached upload IDs without transferring bytes on cache hits.
Keeps
.appdirectory uploads on the existing tar-stream path until app-bundle caching is supported, and adds focused upload-client tests for hit, miss, legacy fallback, and app-bundle behavior.Touched files: 2. Scope stayed within the upload client path.
Validation
pnpm exec oxfmt --write src/upload-client.ts src/__tests__/upload-client.test.tspnpm check:quickpnpm test src/__tests__/upload-client.test.ts